package kd.bos.kdec.pincar;

import java.util.EventObject;
import java.util.HashMap;
import java.util.Map;

import kd.bos.dataentity.utils.StringUtils;
import kd.bos.form.FormShowParameter;
import kd.bos.form.ShowType;
import kd.bos.form.control.Control;
import kd.bos.form.plugin.AbstractFormPlugin;

/**
 * 拼车我的 设置
 * 
 * @author zhangyizhe
 *
 */
public class PinCarForMobSetting extends AbstractFormPlugin {

	private String[] buttons = new String[] { "nomarlplace", "aboutus", "callus" };

	@Override
	public void registerListener(EventObject e) {
		super.registerListener(e);
		this.addClickListeners(this.buttons);
	}

	@Override
	public void click(EventObject evt) {
		super.click(evt);
		Control control = (Control) evt.getSource();
		String key = control.getKey();
		Map<String, Object> formId = new HashMap<>();
		if (StringUtils.equals("nomarlplace", key)) {// 常用地址
			formId.put("formId", "kdec_pincar_nomalplace");
			this.showForm(formId);
		} else if (StringUtils.equals("aboutus", key)) {// 关于我们

		} else if (StringUtils.equals("callus", key)) {// 联系我们

		}
	}
	/**
	 * 页面跳转通用方法
	 * 
	 * @param formId
	 *            页面标识
	 */
	private void showForm(Map<String, Object> formId) {
		FormShowParameter showParameter = FormShowParameter.createFormShowParameter(formId);
		showParameter.getOpenStyle().setShowType(ShowType.Floating);
		this.getView().showForm(showParameter);
	}

}
